package Hashmap_Arraylist_play;

import java.util.*;

public class Hashmap_Arraylist_play {
	public static void main(String[] args) {
//水浒传
		TreeMap<String, ArrayList<Stu>> TreeMap = new TreeMap<String, ArrayList<Stu>>();

		ArrayList<Stu> S = new ArrayList<Stu>();

		Stu s1 = new Stu("a", "songjiang");
		Stu s2 = new Stu("b", "likui");
		Stu s3 = new Stu("c", "wuyong");

		S.add(s1);
		S.add(s2);
		S.add(s3);

		TreeMap.put("水浒传", S);

//西游记

		ArrayList<Stu> S1 = new ArrayList<Stu>();

		Stu s4 = new Stu("d", "唐僧");
		Stu s5 = new Stu("e", "猪八戒");
		Stu s6 = new Stu("f", "沙和尚");

		S1.add(s4);
		S1.add(s5);
		S1.add(s6);

		TreeMap.put("西游记", S1);

//三国演义	

		ArrayList<Stu> S2 = new ArrayList<Stu>();

		Stu s7 = new Stu("g", "诸葛孔明");
		Stu s8 = new Stu("h", "曹操");
		Stu s9 = new Stu("i", "司马懿");

		S2.add(s7);
		S2.add(s8);
		S2.add(s9);

		TreeMap.put("三国演义", S2);

//打印
		
		for(String key : TreeMap.keySet()){
			System.out.println(key);
			ArrayList<Stu> array = TreeMap.get(key);
			for(int i=0;i<3;i++) {
				Stu s = array.get(i);
				System.out.println(s.getName()+","+s.getNumber());
			}
			
		
		    
		}

	}

}
